package com.tfos.study.mvc.content.negotiating.config;

import com.tfos.study.mvc.content.negotiating.view.resolver.ExcelViewResolver;
import com.tfos.study.mvc.content.negotiating.view.resolver.HtmlViewResolver;
import com.tfos.study.mvc.content.negotiating.view.resolver.PdfViewResolver;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 类功能说明：配置视图解析器 <br/>
 * 公司名称：TF（腾飞）开源 <br/>
 * 作者：luorongxi <br/>
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.enableContentNegotiation(new PdfViewResolver());
        registry.enableContentNegotiation(new ExcelViewResolver());
        registry.enableContentNegotiation(new HtmlViewResolver());
        // 上面三个注册方法必须在此方法之上执行
        registry.enableContentNegotiation(false);
    }
}
